#include "visualizadorAbstrato.h"
#include "visualizadorListaLigada.h"

//------------------------------------------------------------------------------
visualizadorListaLigada::visualizadorListaLigada(float x,float y):visualizadorAbstrato(x,y)
{
	lstListaLigada = new ListaLigada;
};
//------------------------------------------------------------------------------
visualizadorListaLigada::~visualizadorListaLigada()
{
	delete lstListaLigada;
	lstListaLigada = NULL;
};
//------------------------------------------------------------------------------
void visualizadorListaLigada::desenha(TImage *area, double escalaX, double escalaY)const
{
		area->Canvas->Brush->Color = clGreen;
		area->Canvas->Rectangle((getX())*escalaX,(getY())*escalaY,(getX()+44)*escalaX,(getY()+44)*escalaY);
		if(escalaX == 1)
		{
				area->Canvas->Brush->Color = clWhite;
				area->Canvas->Rectangle((getX()+2)*escalaX,(getY()+6)*escalaY,(getX()+25)*escalaX,(getY()+37)*escalaY);

				//linhas da lista
				area->Canvas->MoveTo(getX()+5,getY()+10);
				area->Canvas->LineTo(getX()+20,getY()+10);

				area->Canvas->MoveTo(getX()+5,getY()+10);
				area->Canvas->LineTo(getX()+5,getY()+25);

				area->Canvas->MoveTo(getX()+5,getY()+13);
				area->Canvas->LineTo(getX()+20,getY()+13);

				area->Canvas->MoveTo(getX()+20,getY()+13);
				area->Canvas->LineTo(getX()+20,getY()+25);



				area->Canvas->MoveTo(getX()+5,getY()+16);
				area->Canvas->LineTo(getX()+20,getY()+16);
				area->Canvas->MoveTo(getX()+5,getY()+19);
				area->Canvas->LineTo(getX()+20,getY()+19);
				area->Canvas->MoveTo(getX()+5,getY()+22);
				area->Canvas->LineTo(getX()+20,getY()+22);
				area->Canvas->MoveTo(getX()+5,getY()+25);
				area->Canvas->LineTo(getX()+20,getY()+25);

				//texto
				area->Canvas->TextOutA((getX()+6)*escalaX,(getY()+29)*escalaY,"Lista" +IntToStr(getIdentidade()));


		 }
};
//------------------------------------------------------------------------------
void visualizadorListaLigada::interage()
{
	TfrmListaLigada * frmListaSimples = new TfrmListaLigada(Application, lstListaLigada);
	frmListaSimples->ShowModal();
	delete(frmListaSimples);
	frmListaSimples = NULL;
};
//------------------------------------------------------------------------------

